Extracts data from a specified URL.
POST/smart_scraper
Returns the required data from a specified URL using a given prompt and/or schema.
Authentication:
To authenticate with the SmartScraper API, you need to include the SG-APIKEY
header in your requests. This header should contain your API key.
Request
- application/json
Body
required
url stringrequired
The URL of the web page to scrape.
prompt stringrequired
The prompt describing what data to extract.
schema string
The schema for structuring the extracted data
Responses
- 200
- 400
- 500
The response will be a JSON object containing the extracted data and metadata about the request.
- application/json
- Schema
- Example (from schema)
Schema
success booleanrequired
Indicates whether the scraping was successful.
credits_left stringrequired
Remaining credits for the user.
url stringrequired
The URL that was scraped.
result objectrequired
The data extracted from the web page.
{
"success": true,
"credits_left": "string",
"url": "string",
"result": {}
}
The SG-APIKEY header was not provided.
Internal Server Error
- application/json
- Schema
- Example (from schema)
Schema
error stringrequired
Error message
details stringrequired
Detailed description of the error
{
"error": "Failed to save result to DynamoDB",
"details": "An error occurred while saving the scraped data to the database.'"
}
Loading...